﻿Public Class FrmMaintainace
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        If InvokeRequired Then
            Dim eventArgs() As Object = {sender, e}
            Invoke(New EventHandler(AddressOf OK_Click), _
              eventArgs)
            Return
        End If
        gEngineerPwd = GetSetting(My.Application.Info.Title, "Setting", "Engineer", "123")
        gAdminPwd = GetSetting(My.Application.Info.Title, "Setting", "Admin", "LNLON")
        Try
            If PasswordTextBox.Text = gEngineerPwd Or PasswordTextBox.Text = gAdminPwd Then
               SaveSetting("XCPro", "Settings", "UserTimes", gUserTime - 1)
                Me.Close()
            Else
                MsgBox("密码错误! ")
                Me.Show()
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        FrmMain.Close()
    End Sub

    Private Sub FrmAdmin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PasswordTextBox.Clear()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Try
            If MsgBox("Reset Password as Before !", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
                SaveSetting(My.Application.Info.Title, "Setting", "Engineer", "123")
                SaveSetting(My.Application.Info.Title, "Setting", "Admin", "XC")
            Else
                Exit Sub
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class
